<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('人工费用列表')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">人工费用</li>
    </ol>
    <div class="aLine"></div>
</div>
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>员工姓名：</label>
                                <input type="text" name="loginName"/>
                            </li>
<!--                            <li>-->
<!--                                <label>员工工资：</label>-->
<!--                                <input type="text" name="sMoney"/>-->
<!--                            </li>-->
<!--                            <li class="select-time">-->
<!--                                <label>工资日期：</label>-->
<!--                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginSDate]"/>-->
<!--                                <span>-</span>-->
<!--                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endSDate]"/>-->
<!--                            </li>-->
                            <li>
                                <label>余额：</label>
                                <input type="text" name="balance"/>
                            </li>
<!--                            <li>-->
<!--                                <label>下发状态：</label>-->
<!--                                <select name="sStatus" th:with="type=${@dict.getType('salary_status')}">-->
<!--                                    <option value="">所有</option>-->
<!--                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}">-->
<!--                                    </option>-->
<!--                                </select>-->
<!--                            </li>-->
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
<!--            <div class="col-sm-12 search-collapse">-->
<!--                <form id="formIdB">-->
<!--                    <div class="select-list">-->
<!--                        <ul>-->
<!--                            <li class="select-time">-->
<!--                                <label>工资日期：</label>-->
<!--                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginSDate]"/>-->
<!--                                <span>-</span>-->
<!--                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endSDate]"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formIdB')"><i class="fa fa-search"></i>&nbsp;搜索</a>-->
<!--                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>-->
<!--                            </li>-->
<!--                        </ul>-->
<!--                    </div>-->
<!--                </form>-->
<!--            </div>-->
            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:salary:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:salary:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:salary:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:user:exports">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"style="color: black;font-size: 15px"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:salary:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:salary:remove')}]];
        var creadFlag = [[${@permission.hasPermi('system:salary:add')}]];
        // var detailFlag = [[${@permission.hasPermi('system:salary:detail')}]];
        var moneys = [[${@permission.hasPermi('system:salary:money')}]];
        // 获取数据字典数据
        var sStatuss = [[${@dict.getType('salary_stdetailatus')}]];
        var prefix = ctx + "system/salary";
        var prefixs = ctx + "system/user";
        $(function() {
            var options = {
                url: prefixs + "/lists",
                createUrl: prefix + "/add/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefixs + "/exports",
                showColumns: false,
                modalName:'员工工资',
                // onExpandRow: function (index, row, $detail) {
                //     initChildTable(index, row, $detail);
                // },
                columns: [
                {
                    field: 'userId',
                    title: '员工id',
                    visible: false
                },
                {
                    field: 'loginName',
                    title: '员工姓名'
                },
                {
                    //field: 'balance',
                    title: '余额',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.balance==null){
                            actions.push('￥'+0);
                            return actions.join('');
                        }else{
                            actions.push('￥'+row.balance);
                            return actions.join('');
                        }
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success ' + creadFlag + '" href="javascript:void(0)" onclick="cread(\'' + row.userId + '\')"><i class="fa fa-plus"></i>增加工资</a> ');
                        actions.push('<a class="btn btn-success ' + moneys + '" href="javascript:void(0)" onclick="money(\'' + row.userId+'\')"><i class="fa fa-plus"></i>详情</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function money(userId){
            var url = prefix + '/money/' + userId;
            $.ajax({
                url:prefix+"/listname",
                dataType:"json",
                data:{"userId":userId},
                type:"post",
                success:function (data) {
                    $.modal.openTab(data.loginName+"工资详情", url);
                  }
            })
        }
        function cread(userId) {
            var urll = prefix + '/add/' + userId;
            $.ajax({
                url:prefix+"/listname",
                dataType:"json",
                data:{"userId":userId},
                type:"post",
                success:function (data) {
                    $.modal.openFull("增加"+data.loginName+"工资",urll)
                }
            })
        }
        // initChildTable = function (index, row, $detail) {
        //     var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');
        //     $(childTable).bootstrapTable({
        //         url: prefix + "/listsBalance",
        //         // updateUrl: prefix + "/edit/{id}",
        //         method: 'post',
        //         sidePagination: "server",
        //         showFooter:true,
        //         contentType: "application/x-www-form-urlencoded",
        //         queryParams: {
        //             sName:row.userId
        //         },
        //         rowStyle:{
        //             css:{"background":"lightyellow"}
        //         },
        //         columns: [
        //             {
        //               field: "sId",
        //                 title: '员工工资',
        //                 visible: false
        //             },
        //             {
        //                 //field: 'sMoney',
        //                 title: '员工工资',
        //                 formatter: function(value, row, index) {
        //                 var actions = [];
        //                 actions.push('￥'+row.sMoney);
        //                 return actions.join('');
        //                 },
        //                 footerFormatter: function(value){
        //                     var sum = 0;
        //                     for (var i in value) {
        //                         sum += parseFloat(value[i].sMoney)
        //                     }
        //                     return "该员工总工资: ￥"+sum;
        //                 }
        //             },
        //             {
        //                 //field : 'sDate',
        //                 title : '工资日期',
        //                 formatter: function(value, row, index) {
        //                     var actions = [];
        //                     if(row.sDate==null){
        //                         actions.push('未设置工资日期');
        //                         return actions.join('');
        //                     }else{
        //                         actions.push(row.sDate);
        //                         return actions.join('');
        //                     }
        //                 }
        //
        //             },
        //             {
        //                 field: 'sStatus',
        //                 title: '下发状态 ',
        //                 formatter: function(value, row, index) {
        //                     return $.table.selectDictLabel(sStatuss, value);
        //                 }
        //             },
        //             {
        //                 field : 'sBalance',
        //                 title : '下发金额',
        //                 // formatter: function(value, row, index) {
        //                 //     var actions = [];
        //                 //      if(row.sBalance==null){
        //                 //         actions.push('￥'+0);
        //                 //         return actions.join('');
        //                 //     }else{
        //                 //         actions.push('￥'+row.sBalance);
        //                 //         return actions.join('');
        //                 //     }
        //                 // },
        //                 footerFormatter: function(value){
        //                     var sum =0;
        //                     for (var i in value) {
        //                         if(value[i]==null){
        //                             value[i]=0
        //                         }
        //                         sum += parseFloat(value[i].sBalance)
        //                     }
        //                     if(sum==0){
        //                         return "该员工总下发工资: ￥"+0;
        //                     }else if(sum==null){
        //                         return "该员工总下发工资: ￥"+0;
        //                     } else{
        //                         return "该员工总下发工资: ￥"+sum;
        //                     }
        //                 }
        //             },
        //             {
        //                 title: '操作',
        //                 align: 'center',
        //                 formatter: function (value, row, index) {
        //                     var actions = [];
        //                     actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="authRole(\'' + row.sId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
        //                     actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.sId + '\')"><i class="fa fa-search"></i>下发</a> ');
        //                     // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.sId + '\')"><i class="fa fa-remove"></i>删除</a>');
        //                     return actions.join('');
        //                 }
        //             }]
        //     });
        //
        //
        //
        // };
        // /* 财务管理-修改 */
        // function authRole(sId) {
        //     var url = prefix + '/edit/' + sId;
        //     $.modal.open("修改", url);
        // }
        // /* 财务管理-下发工资 */
        // function detail(sId) {
        //     var url = prefix + '/detail/' + sId;
        //     $.modal.open("下发", url,"500","300");
        // }
    </script>
</body>
</html>